package com.example.exampleconsumer;

import com.example.examplecommon.model.User;
import com.example.examplecommon.service.UserService;
import com.example.yurpceasy.proxy.ServiceProxyFactory;

/**
 * 简易服务消费者示例
 */
public class EasyConsumerExample {

    public static void main(String[] args) {
        // 静态代理
        //UserService userService = new UserServiceProxy();

        // 动态代理
        UserService userService = ServiceProxyFactory.getMockProxy(UserService.class);
        User user = new User();
        user.setName("lalalallalala luwenjing");
        // 调用
        User newUser = userService.getUser(user);
        System.out.println(newUser);

//        if (newUser != null) {
//            System.out.println(newUser.getName());
//        } else {
//            System.out.println("user == null");
//        }
    }
}